Basic Library Overview / TreeView for UWP / TreeView for UWP Task-Based Help / Getting the Text or Value of the SelectedItem in a TreeView
Getting the Text or Value of the SelectedItem in a TreeView
In This Topic

The Header property will return the values contained in your C1TreeViewItems, you can get the string value using the following code:

Visual Basic
Copy Code
Dim item As C1TreeViewItem = _tree.SelectedItem
_textBlock.Text = item.Header.ToString()

C#
Copy Code
C1TreeViewItem item = _tree.SelectedItem;
_textBlock.Text = item.Header.ToString();

What You've Accomplished

Run your application and observe that the Header property will return the values contained in your C1TreeViewItems.

See Also